package main

import (
	"encoding/json"
	"fmt"
)

type Mobie struct {
	Title  string   `json:"title"`
	Year   int      `json:"year"`
	Price  int      `json:"price"`
	Actors []string `json:"actors"`
}

func main() {
	mobie := Mobie{"喜剧之王", 2000, 10, []string{"周星驰", "张柏芝"}}
	marshal, err := json.Marshal(mobie)
	if err != nil {
		fmt.Println("json Marshal err:", err)
		return
	}
	fmt.Printf("%s\n", marshal)
	fmt.Println(string(marshal))

	mobileUnmarshal := &Mobie{}
	json.Unmarshal(marshal, mobileUnmarshal)
	fmt.Println(mobileUnmarshal)

}
